package hgx.spring.cloud.lession.orderserver.vo;

/**
 * Created by liujun on 2018/3/13.
 */

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * 订单请求参数
 *
 * @author Administrator
 * @create 2018-03-13 16:57
 */
public class RequestProductVo implements Serializable {
    private static final long serialVersionUID = 552878288216848785L;


    private Map<Long, Integer> productMap;

    /**
     * 添加商品
     *
     * @param productId 商品ID
     * @param num       购买商品数量
     * @return
     */
    public boolean addPruduct(Long productId, Integer num) {
        if (productId == null || num == null || num <= 0) {
            return false;
        }
        if (productMap == null) {
            productMap = new HashMap<Long, Integer>();
        }


        productMap.put(productId, num);
        return true;


    }

    /**
     * 获取商品集合
     *
     * @return productMap
     */
    public Map<Long, Integer> getProductMap() {
        return productMap;
    }

    public void setProductMap(Map<Long, Integer> productMap) {
        this.productMap = productMap;
    }


}
